package com.hpf.cloud.exception;

import com.hpf.cloud.pojo.ResultCode;
import lombok.Data;

/**
 * @description: 公共的异常抛出,throwable中有detailMessage的属性
 * @datetime: 2020/11/15 19:52
 * @author: Fred
 */
@Data
public class CommonException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    private int code;

    public CommonException() {
        super();
    }

    public CommonException(String message, Throwable cause) {
        super(message, cause);
    }

    public CommonException(String message) {
        super(message);
    }

    public CommonException(Throwable cause) {
        super(cause);
    }

    public CommonException(ResultCode resultCode){
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
    }
}
